package com.gklyj.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gklyj.pojo.Zhanghao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface zhanghaoMapper extends BaseMapper<Zhanghao> {


    //登陆验证，查询是否有该账号
    @Select("select * from zhanghao where username=#{username} and password=#{password}")
    Zhanghao findOneData(Zhanghao zhanghao);

    @Select("select z_id from zhanghao where username=#{username} and password=#{password}")
    Integer findIdByUsername_Password(String username,String password);

    //根据session中的username查找用户角色，用于登录后更具角色跳转不同主页
    @Select("select role from zhanghao where username = #{username}")
    String findRoleByUsername(String username);

    //根据账号查询账号以及密码
    @Select("select * from zhanghao where username = #{username}")
    Zhanghao findZhangHaoByUsername(String username);

}
